package com.fp.m7.model;

import java.util.Date;

import org.neo4j.graphdb.Direction;
import org.springframework.data.neo4j.annotation.NodeEntity;
import org.springframework.data.neo4j.annotation.RelatedTo;

@NodeEntity
public class Comment extends EntityBase implements com.fp.m7.api.model.Comment {
	private static final long serialVersionUID = 2556446331444084432L;

	@RelatedTo(type = "POSTS", direction = Direction.INCOMING)
	private Account author;

	private String content;

	public Comment() {
	}

	public Comment(Account author, String content) {
		this.author = author;
		this.content = content;
	}

	@Override
	public Account getAuthor() {
		return author;
	}

	@Override
	public void setAuthor(com.fp.m7.api.model.Account author) {
		this.author = (Account) author;
	}

	@Override
	public String getContent() {
		return content;
	}

	@Override
	public void setContent(String content) {
		this.content = content;
	}

	@Override
	public Date getIssuedDate() {
		return auditCD == null ? null : new Date(auditCD);
	}

	@Override
	public void setIssuedDate(Date date) {
		auditCD = (date == null) ? null : date.getTime();
	}

	@Override
	public String toString() {
		return new StringBuilder("Comment [id=").append(id) //
				.append(", author=").append(author) //
				.append(", content=").append(content) //
				.append(", auditCD=").append(auditCD) //
				.append("]").toString();
	}

}
